package BehavioralPatterns.ChainOfResponsibility;

public class Test {

  private static AbstractLogger getChainOfLoggers(){
    ConsoleLogger consoleLogger = new ConsoleLogger(AbstractLogger.INFO);
    FileLogger fileLogger = new FileLogger(AbstractLogger.DEBUG);
    ErrorLogger errorLogger = new ErrorLogger(AbstractLogger.ERROR);

    errorLogger.setNextLogger(fileLogger);
    fileLogger.setNextLogger(consoleLogger);

    return errorLogger;
  }

  public static void main(String[] args) {
    AbstractLogger chainOfLoggers = getChainOfLoggers();

//    chainOfLoggers.logMessage(AbstractLogger.INFO, "This is an information.");

    chainOfLoggers.logMessage(AbstractLogger.DEBUG, "This is a debug level information.");

//    chainOfLoggers.logMessage(AbstractLogger.ERROR, "This is an error information.");
  }
}
